
<%@page import="client.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Credit card check</title>
</head>
<body>
<%
	Ccheck service = new Ccheck();

	// Get the port using port getter method 
    CcheckPortType port = service.getCcheckPort();
    int ccheckAmount = Integer.parseInt(request.getParameter("ccheck_amount"));
	String ccheckName = request.getParameter("ccheck_name");
	String ccheckNumber = request.getParameter("ccheck_number");
	String ccheckType = request.getParameter("ccheck_type");
	String ccheckExpdate = request.getParameter("ccheck_expdate");
   // Invoke the remote method
   CheckCardRequestType cardRequest = new CheckCardRequestType();
   cardRequest.setCardAmount(ccheckAmount);
   cardRequest.setCardName(ccheckName);
   cardRequest.setCardNumber(ccheckNumber);
   cardRequest.setCardType(ccheckType);
   cardRequest.setExpdate(ccheckExpdate);
   
   CheckCardResponseType cardResponse = port.checkCard(cardRequest);
   
   out.print(cardResponse.getMessage());
   if(cardResponse.isValid())
   {
	    String redirectURL = "donationSuccess.jsp";
	    response.sendRedirect(redirectURL);
	   
   }
   else
	   out.println("Not valid card!");

   
%>

</body>
</html>

